package com.facebook.imagepipeline.producers;

import android.content.res.Resources;
import android.net.Uri;
import com.facebook.common.internal.VisibleForTesting;
import com.facebook.imagepipeline.image.EncodedImage;
import com.facebook.imagepipeline.memory.PooledByteBufferFactory;
import com.facebook.imagepipeline.request.ImageRequest;
import java.io.IOException;
import java.util.concurrent.Executor;

public class LocalResourceFetchProducer extends LocalFetchProducer
{

  @VisibleForTesting
  static final String PRODUCER_NAME = "LocalResourceFetchProducer";
  private final Resources mResources;

  public LocalResourceFetchProducer(Executor paramExecutor, PooledByteBufferFactory paramPooledByteBufferFactory, Resources paramResources, boolean paramBoolean)
  {
    super(paramExecutor, paramPooledByteBufferFactory, paramBoolean);
    this.mResources = paramResources;
  }

  // ERROR //
  private int getLength(ImageRequest paramImageRequest)
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore_2
    //   2: aload_0
    //   3: getfield 18	com/facebook/imagepipeline/producers/LocalResourceFetchProducer:mResources	Landroid/content/res/Resources;
    //   6: aload_1
    //   7: invokestatic 27	com/facebook/imagepipeline/producers/LocalResourceFetchProducer:getResourceId	(Lcom/facebook/imagepipeline/request/ImageRequest;)I
    //   10: invokevirtual 33	android/content/res/Resources:openRawResourceFd	(I)Landroid/content/res/AssetFileDescriptor;
    //   13: astore_2
    //   14: aload_2
    //   15: invokevirtual 38	android/content/res/AssetFileDescriptor:getLength	()J
    //   18: lstore 8
    //   20: lload 8
    //   22: l2i
    //   23: istore 6
    //   25: aload_2
    //   26: ifnull +7 -> 33
    //   29: aload_2
    //   30: invokevirtual 42	android/content/res/AssetFileDescriptor:close	()V
    //   33: iload 6
    //   35: ireturn
    //   36: astore 5
    //   38: iconst_m1
    //   39: istore 6
    //   41: aload_2
    //   42: ifnull -9 -> 33
    //   45: aload_2
    //   46: invokevirtual 42	android/content/res/AssetFileDescriptor:close	()V
    //   49: iload 6
    //   51: ireturn
    //   52: astore 7
    //   54: iload 6
    //   56: ireturn
    //   57: astore_3
    //   58: aload_2
    //   59: ifnull +7 -> 66
    //   62: aload_2
    //   63: invokevirtual 42	android/content/res/AssetFileDescriptor:close	()V
    //   66: aload_3
    //   67: athrow
    //   68: astore 10
    //   70: iload 6
    //   72: ireturn
    //   73: astore 4
    //   75: goto -9 -> 66
    //
    // Exception table:
    //   from	to	target	type
    //   2	20	36	android/content/res/Resources$NotFoundException
    //   45	49	52	java/io/IOException
    //   2	20	57	finally
    //   29	33	68	java/io/IOException
    //   62	66	73	java/io/IOException
  }

  private static int getResourceId(ImageRequest paramImageRequest)
  {
    return Integer.parseInt(paramImageRequest.getSourceUri().getPath().substring(1));
  }

  protected EncodedImage getEncodedImage(ImageRequest paramImageRequest)
    throws IOException
  {
    return getEncodedImage(this.mResources.openRawResource(getResourceId(paramImageRequest)), getLength(paramImageRequest));
  }

  protected String getProducerName()
  {
    return "LocalResourceFetchProducer";
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.facebook.imagepipeline.producers.LocalResourceFetchProducer
 * JD-Core Version:    0.6.2
 */